home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 003 / tpbsave.arc / BSAVE.INC < prev    next >
Encoding:
Text File  |  1988-08-11  |  1.2 KB  |  53 lines

  1. procedure bsave(filename:string);
  2.  
  3. {BEAHM  8/10/88}
  4. {cis 70366,713}
  5.  
  6. {This procedure is to be used to BSAVE CGA graphics created by
  7.  Turbo Pascal 4.0. You can then use the graphic in a GWBASIC
  8.  or BASICA program, or you can use it with Print Shop, or any other program
  9.  which uses BSAVEd CGA graphics.  You will need to initialize the graphics
  10.  with the INITGRAPH procedure in the main program before you try to call
  11.  this procedure.}
  12.  
  13.  
  14. {$M 40000,0,655360} {you might need to change the heapmax here}
  15. type
  16.     bspic=array[0..16383] of byte;  {BSAVE PICTURE}
  17.  
  18. var
  19.    ofyle:file of bspic;
  20.    a,          {original getimage array}
  21.    b:bspic;    {bsave array}
  22.    x:integer;
  23.  
  24. begin
  25.  
  26.      getimage(0,0,getmaxx,getmaxy,a);
  27.  
  28.  
  29.      b[0]:=$fd;
  30.      b[1]:=$00;
  31.      b[2]:=$b8;
  32.      b[3]:=$00;
  33.      b[4]:=$00;
  34.      b[5]:=$00;
  35.      b[6]:=$40;
  36.  
  37.      {The next two loops are to take care of the
  38.       interlacing of a BSAVEd graphic, and for the 192 bytes
  39.       between the two scans}
  40.  
  41.      for x:=4 to 8003 do
  42.          b[x+3]:=a[x+((x-4) div 80)*80];
  43.  
  44.      for x:=8004 to 16100 do
  45.          b[x+3+192]:=a[x+((x-4) div 80)*80-15920];
  46.  
  47.      assign(ofyle,filename);
  48.      rewrite(ofyle);
  49.      write(ofyle,b);
  50.      close(ofyle);
  51.  
  52. end;
  53.